import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { UsermanagerVO, UsermanagerForm, UsermanagerQuery } from '@/api/system/user/types';

/**
 * 查询用户信息列表
 * @param query
 * @returns {*}
 */

export const listUsermanager = (query?: UsermanagerQuery): AxiosPromise<UsermanagerVO[]> => {
  return request({
    url: '/system/user/noSuperlist',
    method: 'get',
    params: query
  });
};

/**
 * 查询用户信息详细
 * @param userId
 */
export const getUsermanager = (userId: string | number): AxiosPromise<UsermanagerVO> => {
  return request({
    url: '/system/user/' + userId,
    method: 'get'
  });
};

/**
 * 新增用户信息
 * @param data
 */
export const addUsermanager = (data: UsermanagerForm) => {
  return request({
    url: '/system/usermanager',
    method: 'post',
    data: data
  });
};

/**
 * 修改用户信息
 * @param data
 */
export const updateUsermanager = (data: UsermanagerForm) => {
  return request({
    url: '/system/usermanager',
    method: 'put',
    data: data
  });
};

/**
 * 删除用户信息
 * @param userId
 */
export const delUsermanager = (userId: string | number | Array<string | number>) => {
  return request({
    url: '/system/user/' + userId,
    method: 'delete'
  });
};
